{extend name="public:base" /}
{block name="body"}
<div class="layui-card">
    <div class="layui-card-header">编辑数据</div>
    <div class="layui-card-body">
        <form action="{:request()->url()}" class="layui-form" method="post">
            <div class="layui-form-item">
                <label class="layui-form-label">* 广告图片</label>
                <div class="layui-input-block">
                    <input type="text" name="image" value="{$data.image|default=''}" autocomplete="off" placeholder="请上传图片" class="layui-input">
                    <button type="button" class="layui-btn layui-btn-primary layui-btn-position ajax-images"><i class="fa fa-file-image-o"></i> 选择图片</button>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">* 所属分类</label>
                <div class="layui-input-block">
                    <select name="category">
                        <option value="">请选择所属分类</option>
                        {foreach name="category" key="k" item="v"}
                        <option value="{$k}" {if condition="isset($data) and $data.category eq $k"}selected="selected"{/if}>{$v}[{$k}]</option>
                        {/foreach}
                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">* 广告名称</label>
                <div class="layui-input-block">
                    <input type="text" name="name" value="{$data.name|default=''}" autocomplete="off" placeholder="请输入名称" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">广告描述</label>
                <div class="layui-input-block">
                    <textarea name="description" autocomplete="off" placeholder="请输入描述" class="layui-textarea">{$data.description|default=''}</textarea>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">广告链接</label>
                <div class="layui-input-block">
                    <input type="text" name="url" value="{$data.url|default=''}" autocomplete="off" placeholder="http://" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">打开方式</label>
                <div class="layui-input-block">
                    <input type="radio" name="target" value="_self" title="默认" checked="checked">
                    <input type="radio" name="target" value="_blank" title="新窗口" {if isset($data) and $data.target eq '_blank'}checked="checked"{/if}>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-filter="*" lay-submit="">保存</button>
                    <button class="layui-btn layui-btn-primary" type="reset">重置</button>
                </div>
            </div>
        </form>
    </div>
</div>
{/block}
